www.gusucode.com > Matlab在化学工程中的应用 > Matlab在化学工程中的应用/实用化工计算机模拟-Matlab在化学工程中的应用/Examples/Chapter 4/PorousPlateCat_1Ord.m
function PorousPlateCat_1Ord % 片状催化剂中的一级不可逆等温反应的模拟计算 % Diffusion with Simultaneous Reaction in a porous plate catalyst pellet % % Author: HUANG Huajiang % Copyright 2003 UNILAB Research Center, % East China University of Science and Technology, Shanghai, PRC % $Revision: 1.0 $ $Date: 2003/05/28 $ clear all clc global fai fai = 6; % Thiele模数 a = 0; b = 1; % 求解ODE-BVP问题 % initialize of solution with a guess of y1(x)=0, y2(x)=0 solinit = bvpinit(linspace(a,b,100),[0 0]); sol = bvp4c(@ODEs,@BCfun,solinit); % 绘制浓度分布图 plot(sol.x,sol.y(1,:),'b-') xlabel('Dimensionless Thickness') ylabel('Dimensionless Concentration') % 计算催化剂的有效因子 eta = quadl(@IntFunc,a,b,[],[],sol.x,sol.y(1,:)) fprintf('\t催化剂的有效因子为: η= %.4f',eta) % ------------------------------------------------------------------ function dydx = ODEs(x,y) global fai dydx = [y(2); fai^2*y(1)]; % ------------------------------------------------------------------ function bc = BCfun(ya,yb) bc = [yb(1)-1; ya(2)]; % ------------------------------------------------------------------ function f = IntFunc(x,xi,yi) f = spline(xi,yi,x);